package com.example.lotterybackend.common.exception;


import com.example.lotterybackend.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException {
    private Integer code; // 错误码
    private String msg; // 错误消息

    public ControllerException() {}

    public ControllerException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public ControllerException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }
}
